<?php echo $commander->getListCommandsPanel('sa', ''); ?>
<div class="menu_list">
<table style="clear:both;" id="menulist" class="item_list" cellspacing="0" cellpadding="0" border="0">
	<thead class="fields">
        <tr>
            <th class="first center">&nbsp;&nbsp;#&nbsp;&nbsp;</th>
            <th><?php echo ucfirst($txt->getWord('category')); ?></th>
            <th colspan="2"><?php echo ucfirst($txt->getWord('value')); ?></th>
            <th class="last"><?php echo ucfirst($txt->getWord('delete')); ?></th>
        </tr>
    </thead>
    <tbody>
        <tr class="items">
            <td class="first center">
            <img 
                	title="<?php echo ucfirst($txt->getWord('new')); ?>"
                    class="icon command" 
                    src="<?php echo SYSICONS_URL; ?>add_16.gif" 
                    onclick="if(document.getElementById('new_dem').value != '') { edit_form.submit(); }" />
            </td>
            <td><input class="medium" id="new_dem" name="new_dem" type="text" value="" maxlength="50" /></td>
            <td>&nbsp;</td>
            <td class="last">&nbsp;</td>
        </tr>
        <?php 
		$i = 1;
		if($surveyAdmin->Survey->Demogs):
        foreach($surveyAdmin->Survey->Demogs as $demog)
        {
			?>
			<tr class="items">
				<td class="first left"><?php echo $i++; ?><input type="hidden" name="dem_id[]" value="<?php echo $demog->getId(); ?>" /></td>
				<td><input class="medium" name="dem_title[]" type="text" value="<?php echo $demog->getTitle(); ?>" maxlength="50" /></td>
                <td class="center">
                <img  
                	title="<?php echo ucfirst($txt->getWord('new')); ?>"
                    class="icon command" 
                    src="<?php echo SYSICONS_URL; ?>add_16.gif" 
                    onclick="edit_form.submit();" />
                </td>
                <td><input class="small" name="new_dem_<?php echo $demog->getId(); ?>_val" type="text" value="" maxlength="50" /></td>
				<td class="last center">
					<input title="<?php echo ucfirst($txt->getWord('delete')); ?>" class="inp_image" type="image" name="delete_dem" src="<?php echo SYSICONS_URL; ?>delete_16.gif" value="0" onclick="this.value='<?php echo $demog->getId(); ?>'; " />
				</td>
			</tr>
			<?php
			$j=1;
			if($demog->Values)
			{
				 foreach($demog->Values as $value)
				 {
				?>
				<tr class="items">
					<td class="first left"><?php echo ($i-1); ?>.<?php echo $j++; ?><input type="hidden" name="dem_val_id[]" value="<?php echo $value->Id; ?>" /></td>
					<td>&nbsp;</td>
					<td>&nbsp;</td>
                    <td><input class="small" name="dem_val_value[]" type="text" value="<?php echo $value->Value; ?>" maxlength="50" /></td>
					<td class="last center">
						<input title="<?php echo ucfirst($txt->getWord('delete')); ?>" class="inp_image" type="image" name="delete_dem_val" src="<?php echo SYSICONS_URL; ?>delete_16.gif" value="0" onclick="this.value='<?php echo $value->getId(); ?>'; " />
					</td>
				</tr>
				<?php
				 }
			}
        }
        endif; 
        ?>
	</tbody>
</table>
</div>